<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>一级代理</title>
		<link rel="stylesheet" type="text/css" href="../mobile/js/layer/css/layui.css" />
		<link rel="stylesheet" type="text/css" href="css/main.css" />
		<script src="./js/jquery-3.1.1.min.js"></script>
        <script src="./js/jquery-1.9.1.js"></script>
        <script src="../mobile/js/layer/layui.js"></script>
        <script src="./js/common.js"></script>
	</head>
	<body>
		
		<div class="main_bg">
			
			<div class="order_head">
					<b class="meunhead">
						<a href="javascript:void(0)" class="levelmeun active">
							<span>一级代理</span><i class="iconfont">&#xe601;</i>
						</a>
						<span class="twolevelmeun">一级代理列表</span>
					</b>
					<span class="order_num">共3433记录</span>
					<button class="refresh_btn">刷新</button>
					
					<input type="text" class="seachtext" placeholder="请输入关键字" />
					
					<button class="seachbtn">查找</button>
					
					<button class="iconfont export_btn">&#xe621; 导出一级代理</button>
			</div>
			
			<div class="orderbox">
				<table width="100%" cellpadding="0" cellspacing="0" class="ordertable">
					<thead>
						<tr>
							<th>ID</th>
							<th>代理昵称</th>
							<th>手机号</th>
							<th>QQ</th>
							<th>等级</th>
							<th>身份证</th>
							<th>性别</th>
							<th>日期</th>
							<th>操作</th>
						</tr>
					</thead>
					
					<tbody id="oneagent">
						
					</tbody>
				</table>
				
				
				<div id="page"></div>
			</div>
		</div>
		
		
	</body>

<script src="./js/jquery-3.1.1.min.js"></script>
<script src="./js/jquery-1.9.1.js"></script>
<!-- <script src="./js/common.js"></script> -->
<script src="../mobile/js/layer/layui.js"></script>

<script>
	//首先加载数据
	$(function(){
		// var url="http://qt.hiberbest.com";
		// var url="http://www.xiyiji.com";
		var geturl=url+ "/admin/userlist/onedailiList";
		$.ajax({
				type: 'get',
				async:false,
				dataType: "json",
				url: geturl,
				success: function (data) {
					// console.log(data);
					
					var count = data.datas.length;
					var m = '';
					for (var k=0; k<count; k++) {
						m +='<tr>';
						m +='<td>'+data.datas[k]['id']+'</td>';
						m +='<td>'+data.datas[k]['agent_name']+'</td>';
						m +='<td>'+data.datas[k]['mobile']+'</td>';
						m +='<td>'+data.datas[k]['agent_qq']+'</td>';
						m +='<td>'+data.datas[k]['agent_level']+'</td>';
						m +='<td>'+data.datas[k]['idcard']+'</td>';
						if (data.datas[k]['sex'] == 0) {
							m +='<td>女</td>';
						}else{
							m +='<td>男</td>';
						}
						m +='<td>'+data.datas[k]['addtime']+'</td>';
						m +='<td><a href="daili_detail.html?daili_id='+data.datas[k]['id']+'">查看</a></td>';
						m +='</tr>';
					}
					$('#oneagent').html(m);
					
					layui.use(['laypage', 'layer'], function(){
					var laypage = layui.laypage;
					  //自定义样式
					  laypage.render({
					    elem: 'page'
					    ,count:data.count
					    ,limit: data.limit
					    ,theme: '#35C4F9'
					  });
					});

				},error:function(data){
					console.log("请检查您的网络");
				}
			});
	});
	//点击分页加载事件
		$('#page').click(function(){
			var fenye = $('.layui-laypage-curr').find('em').eq(1).html();
			// var url="http://qt.hiberbest.com";
			var geturl=url+ "/admin/userlist/onedailiList?fenye="+fenye;
			$.ajax({
					type: 'get',
					async:false,
					dataType: "json",
					url: geturl,
					success: function (dete) {
						// console.log(dete);alert(dete);
						var count = dete.datas.length;
						var m = '';
						for (var k=0; k<count; k++) {
						m +='<tr>';
						m +='<td>'+dete.datas[k]['id']+'</td>';
						m +='<td>'+dete.datas[k]['agent_name']+'</td>';
						m +='<td>'+dete.datas[k]['mobile']+'</td>';
						m +='<td>'+dete.datas[k]['agent_qq']+'</td>';
						m +='<td>'+dete.datas[k]['agent_level']+'</td>';
						m +='<td>'+dete.datas[k]['idcard']+'</td>';
						if (dete.datas[k]['sex'] == 0) {
							m +='<td>女</td>';
						}else{
							m +='<td>男</td>';
						}
						m +='<td>'+dete.datas[k]['addtime']+'</td>';
						m +='<td><a href="daili_detail.html?daili_id='+dete.datas[k]['id']+'">查看</a></td>';
						m +='</tr>';
					}
					$('#oneagent').html(m);

					},error:function(dete){
						console.log("请检查您的网络");
					}
				});
		});
	
</script>
		

		
		
	</script>
	
</html>
